﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ly.Web.Admin
{
    public partial class addnews : System.Web.UI.Page
    {
        ly.Model.news newsModel = new Model.news();
        ly.BLL.news newsBLL = new BLL.news();
        protected void Page_Load(object sender, EventArgs e)
        {

        }


        protected void btntianjia_Click(object sender, EventArgs e)
        {


            newsModel.news_name = txtworkname.Text.Trim();//新闻的标题
            newsModel.news_image = txtusername.Text.Trim();//新闻的发布人
            newsModel.news_createtime = Convert.ToDateTime(startTime.Value.Trim());//发布时间
            newsModel.news_content= FCKeditor1.Value.Trim();//新闻的具体内容
            newsModel.news_seetime = 0;//查看次数首设为0
            bool cou = newsBLL.Add(newsModel);
            if (cou)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加成功');</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加失败');</script>");
            }
        }

    }
}